package org.cainiao.jvm.loadclass.classloader;

public class ClassLoaderTest {

    public static void main(String[] args) {
        print();
    }

    public static void print() {
        ClassLoader appClassLoader = ClassLoaderTest.class.getClassLoader();
        ClassLoader platformClassLoader = appClassLoader.getParent();
        ClassLoader bootClassLoader = platformClassLoader.getParent();

        System.out.printf("bootClassLoader = %s%n", bootClassLoader);
        System.out.printf("platformClassLoader = %s%n", platformClassLoader);
        System.out.printf("appClassLoader = %s%n", appClassLoader);

        System.out.printf("%nString.class.getClassLoader() = %s%n", String.class.getClassLoader());
    }

    public static void urls() {
        // sun.misc.Launcher 在 JDK9 已被移除
        /*
         URL[] bootstrapClassPaths = sun.misc.Launcher.getBootstrapClassPath().getURLs();

         for (URL url : bootstrapClassPaths) {
         System.out.println(url.toExternalForm());
         }
         */
    }
}
